/**
 * 
 */
package com.google.code.netz.wfe.model;

import com.google.code.netz.wfe.api.IManaged;

/**
 * Work Item is defined as a {@link ITask}/{@link Transition} that is enabled and
 * needs to be executed for a specific {@link CaseImpl}.
 * 
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: WorkItem.java 19 2009-02-22 15:13:24Z rahul.thakur.xdev $
 * 
 */
public class WorkItem<D> implements IManaged {

	private ICase<D> kase;

	private Transition<?> transition;

	private State currentState = State.STATE_DEFAULT;

	/**
	 * @param kase
	 * @param transition
	 */
	public WorkItem(ICase<D> kase, Transition<?> transition) {
		super();
		this.kase = kase;
		this.transition = transition;
	}

	/**
	 * @return the kase
	 */
	public ICase<D> getKase() {
		return kase;
	}

	/**
	 * @return the transition
	 */
	public Transition<?> getTransition() {
		return transition;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.api.IManaged#getCurrentState()
	 */
	@Override
	public State getCurrentState() {
		return this.currentState;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.api.IManaged#setCurrentState(com.google.code
	 *      .netz.wfe.model.State)
	 */
	@Override
	public void setCurrentState(State state) {
		this.currentState = state;
	}

}
